package com.qidian.mes.store.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.pojo.Store;
import com.qidian.mes.store.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 任超
 * Time 2024/10/25 18:39
 */
@RestController
@RequestMapping("/store")
@CrossOrigin
public class StoreController {

    @Autowired
    private StoreService storeService;

    @GetMapping("/list")
    public MESResult list(Store store, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit){
        return storeService.selectList(store,page,limit);
    }

    @PutMapping("/add")
    public MESResult addStoreSetting(@RequestBody Store store){
        return storeService.addStoreSetting(store);
    }

    @PutMapping("/update")
    public MESResult updateStoreSetting(@RequestBody Store store){
        return storeService.updateStoreSetting(store);
    }

    @GetMapping("/selectById")
    public MESResult selectById(Long storeId){
        return storeService.selectById(storeId);
    }

    @PutMapping("/delete")
    public MESResult delete(Long storeId){
        return storeService.updateStoreStatus(storeId);
    }
}
